
my $wd="/Volumes/HD_2/Documents/workspace/data/terry/comparison_TSS_NDR_call/fixedWindowCorrectP/";
my @pValues=(0.05);
my @dataPoints=(0);
my @gchNums=(0);
my $useWcg=0;
my $overlap=1;



my $outputBed=1;
my $annoRegionExtend=10;
my $file1="callable_window.IMR90.knownGene-tss-UCSC062409.hg19.nodups..sig0.01.std20.mdp0.npw150.up100.down50.bed";
my $sample1="IMR90";
opendir(DH,"/Volumes/HD_2/Documents/workspace/data/terry/comparison_TSS_NDR_call/fixedWindowCorrectP/");
	foreach my $file(readdir(DH)){
		if($file=~/\S+hg19\S+minusUpstream0.plusDownstream0.bed$/ or $file=~/GSM468792_UW.IMR90.ChromatinAccessibility.IMR90_fixed_200_standard.peaks.hg19.gtf$/){
			my $annoFormat="bed";
			if($file =~ /GSM468792_UW.IMR90.ChromatinAccessibility.IMR90_fixed_200_standard.peaks.hg19.gtf$/){
				$annoFormat="gtf";
			}
			my $annoName=$file;
			foreach my $dataPoint(@dataPoints){
				foreach my $pValue(@pValues){
					foreach my $gchNum(@gchNums){
						my $R_script="/Volumes/HD_2/Documents/workspace/dnaase_google_script/edu.usc.epigenome.dnaase.Rscript/1-way_NDR_Overlap.R";
						my $R_cmd = "R --no-restore --no-save --args wd=$wd file1=$file1 sample1=$sample1 pValue=$pValue anno=$file annoName=$annoName annoFormat=$annoFormat annoRegionExtend=$annoRegionExtend overlap=$overlap outputBed=$outputBed useWcg=$useWcg dataPoint=$dataPoint gchNum=$gchNum < $R_script \n";
						system($R_cmd);
					}
				}
			}
		}
			
	}

closedir(DH);




